/*
*/ 

#ifndef PGM_H
#define PGM_H

#include "obj3d.h"

/*pgm structure:

  pgmHeader
  pgmPath
  pgmXYZ
  pgmXYZ
  pgmXYZ
  ...
  pgmPath
  pgmXYZ
  pgmXYZ
  pgmXYZ
  ...
 */

#define PGM_VERSION 1
#define PGM_MAGIC (('P') | ('G'<<8) | ('M'<<16) | ('1'<<24))
#define PATH_MAGIC (('P') | ('A'<<8) | ('T'<<16) | ('H'<<24))


typedef struct 
{
    int ident;        // identifies as pgm header  (pgm1)
    int version;      // 1
    unsigned int numPath;    // number of objects
} pgmHeader;


typedef struct
{
    int magic; //
	int ID;    // rendering ID
    unsigned int numPt;       // number of points
} pgmPath;


typedef struct
{
    float  x,y,z;
} pgmXYZ;


typedef struct {
	vector *points;
	unsigned int numPt;
	int ID;
	void* NextPath;
} pgmmodel; 

//prototypes
int load_pgm(char *filename, pgmmodel *obj);
int pgm_getindex(int index,float* delta,vector* Vec, float* angle, pgmmodel *pgm_model);
void free_pgm(pgmmodel *pgm_model);


#endif
